# -*- coding:utf-8 -*-
__author__ = 'shuxin'
__date__ = '2020/6/13  15:45'

import json

from django.http import HttpResponse
from django.views import View


class OrderExportView(View):
    def get(self, request):
        info = {
            "code": 0,
            "message": "SUCCESS",
            "createTime": 1592282877855,
            "result": {
                "ret": True,
                "ver": "1.0",
                "data": [
                    {
                        "id": 4366,
                        "orderNo": "5ee638b24614a4d3ed0b98f4",
                        "flightType": "1",
                        "status": 2,
                        "childrenCount": 1,
                        "adultsCount": 1,
                        "passengerCount": 2,
                        "flightSegmentNum": 1,
                        "adultPrice": 1435,
                        "adultTax": 30,
                        "childPrice": 1525,
                        "childTax": 30,
                        "allPrice": 3020,
                        "policyId": 0,
                        "policyIds": "0",
                        "source": "pangolin",
                        "pnrCode": "ELALJX",
                        "pnrStatus": 0,
                        "changeDateRule": "不予改期|不予改期",
                        "luggageRule": " 无免费托运行李额",
                        "statement": "改期：若改期产生机票差价需另行支付。退票：手续费仅与票面价相关，而税费是否退改需要以航司为准。",
                        "contactName": "去哪儿新业务运营",
                        "contactMob": "010******4393",
                        "contactTel": "",
                        "contactEmail": "ifl*********@163.com#",
                        "createTime": 1577844568000,
                        "lastUpdated": 1577848777000,
                        "returnTicketRule": "不予退票和退税|不予退票和退税",
                        "gdsType": "Eterm",
                        "airlinePnrCode": "",
                        "policyRemark": None,
                        "passengers": [
                            {
                                "id": 6588,
                                "name": "SHENG/BO",
                                "gender": "M",
                                "age_type": 1,
                                "birthday": "2015-10-28",
                                "nationality": "CN",
                                "card_type": "PP",
                                "card_num": "EH9069400",
                                "card_expired": "2024-12-26",
                                "card_issue_place": "CN",
                                "ticket_price": 1525,
                                "fare_type": None
                            },
                            {
                                "id": 6589,
                                "name": "YAO/JUN",
                                "gender": "F",
                                "age_type": 0,
                                "birthday": "1984-10-16",
                                "nationality": "CN",
                                "card_type": "PP",
                                "card_num": "E16400179",
                                "card_expired": "2024-05-18",
                                "card_issue_place": "CN",
                                "ticket_price": 1435,
                                "fare_type": None
                            }
                        ],
                        "flight_segments": [
                            {
                                "carrier": "AK",
                                "flight_num": "AK2139",
                                "cabin": "T",
                                "plane_module": "",
                                "terminal": "",
                                "dep_aircode": "WUH",
                                "arr_aircode": "BKI",
                                "departure_date": "2020-01-09",
                                "departure_time": "23:45",
                                "arrival_date": "2020-01-10",
                                "arrival_time": "03:55",
                                "group": 0
                            }
                        ],
                        "ticketDeadline": None,
                        "mainOrderNo": "nzi200101100928682ec108",
                        "policySrc": "国际运价直连",
                        "officeId": None,
                        "productName": "低价特惠",
                        "vipTag": False,
                        "cheapPackageName": None,
                        "subOrderNos": ['123456789789456','987456321123456'],
                        "ticketStatus": {
                            "CZNJMZ": "校验成功"
                        },
                        "marketOutside": "0",
                        "marketOutsideTime": "0",
                        "orderType": 0,
                        "pristinePrice": "0",
                        "pType": None,
                        "saleChannel": None,
                        "accountCode": None,
                        "ticketAirline": None
                    },
                    {
                        "id": 4367,
                        "orderNo": "5ee714f3e26e18d5433f5be2",
                        "flightType": "1",
                        "status": 2,
                        "childrenCount": 0,
                        "adultsCount": 1,
                        "passengerCount": 1,
                        "flightSegmentNum": 1,
                        "adultPrice": 697,
                        "adultTax": 30,
                        "childPrice": 0,
                        "childTax": 0,
                        "allPrice": 727,
                        "policyId": 0,
                        "policyIds": "0",
                        "source": "pangolin",
                        "pnrCode": "IACEIV",
                        "pnrStatus": 0,
                        "changeDateRule": "不予改期|不予改期",
                        "luggageRule": " 无免费托运行李额",
                        "statement": "改期：若改期产生机票差价需另行支付。退票：手续费仅与票面价相关，而税费是否退改需要以航司为准。",
                        "contactName": "去哪儿新业务运营",
                        "contactMob": "010******4393",
                        "contactTel": "",
                        "contactEmail": "ifl*********@163.com#",
                        "createTime": 1577847046000,
                        "lastUpdated": 1577847407000,
                        "returnTicketRule": "不予退票和退税|不予退票和退税",
                        "gdsType": "Eterm",
                        "airlinePnrCode": "",
                        "policyRemark": None,
                        "passengers": [
                            {
                                "id": 6590,
                                "name": "CHEN/XIULIAN",
                                "gender": "F",
                                "age_type": 0,
                                "birthday": "1979-12-30",
                                "nationality": "CN",
                                "card_type": "PP",
                                "card_num": "EH4620958",
                                "card_expired": "2029-10-07",
                                "card_issue_place": "CN",
                                "ticket_price": 697,
                                "fare_type": None
                            }
                        ],
                        "flight_segments": [
                            {
                                "carrier": "AK",
                                "flight_num": "AK126",
                                "cabin": "I",
                                "plane_module": "",
                                "terminal": "",
                                "dep_aircode": "KUL",
                                "arr_aircode": "SZX",
                                "departure_date": "2020-01-21",
                                "departure_time": "06:10",
                                "arrival_date": "2020-01-21",
                                "arrival_time": "10:20",
                                "group": 0
                            }
                        ],
                        "ticketDeadline": None,
                        "mainOrderNo": "nzi200101105046423c2204",
                        "policySrc": "国际运价直连",
                        "officeId": None,
                        "productName": None,
                        "vipTag": False,
                        "cheapPackageName": None,
                        "subOrderNos": ['123456789789456','987456321123456'],
                        "ticketStatus": {
                            "U1R74J": "校验成功"
                        },
                        "marketOutside": "0",
                        "marketOutsideTime": "0",
                        "orderType": 0,
                        "pristinePrice": "0",
                        "pType": None,
                        "saleChannel": None,
                        "accountCode": None,
                        "ticketAirline": None
                    }
                ]
            }
        }
        error_info = {
            "status": "F103",
            "msg": "订单状态不正确",
            "orderLists": None
        }

        return HttpResponse(json.dumps(info, ensure_ascii=False), content_type="application/json")
